<%
  @title = t('.title')
  add_breadcrumb "Dashboard", dashboard_path
  add_breadcrumb "Organizations"
%>

<% content_for :subject do %>
  <%= render "dashboards/subject", user: current_user, current: :organizations %>
<% end %>

<!-- Main Content -->
<h1 class="text-h2 mb-10 space-x-2">
  <span><%= t("dashboards.show.organizations") %></span>
  <% unless @memberships.size.zero? %>
    <span class="font-light text-neutral-600"><%= @memberships.size %></span>
  <% end %>
</h1>

<!-- Organizations -->
<%= render CardComponent.new do |c| %>
  <%= c.divided_list do %>
    <% if @memberships.size.zero? %>
      <%= c.list_item do %>
        <%= t(".no_organizations") %>
      <% end %>
    <% else %>
      <% @memberships.each do |membership| %>
        <%= c.list_item_to(organization_path(membership.organization.handle)) do %>
          <div class="flex flex-row w-full justify-between items-center">
            <div class="flex flex-col">
              <p class="text-neutral-800 dark:text-white"><%= membership.organization.name %></p>
              <p class="text-b3 text-neutral-600"><%= membership.organization.handle %></p>
            </div>
            <p class="text-neutral-500 capitalize"><%= membership.role %></p>
          </div>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>
